package com.rgp.servicedriveruser.controller;

import com.rgp.internalcommon.dto.ResponseResult;
import com.rgp.servicedriveruser.pojo.Car;
import com.rgp.servicedriveruser.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author nhp
 * @version 1.0
 * @description TODO
 * @date 2024-04-16 20:08
 */
@RestController
public class CarController {

    @Autowired
    private CarService carService;

    @GetMapping("car/{id}")
    public ResponseResult selectCarById(@PathVariable("id") Long id){
        return carService.selectCarById(id);
    }

    @PostMapping("/car")
    public ResponseResult addCar(@RequestBody Car car){
        return carService.insertCarEntity(car);
    }
}